<?php

include($_SERVER["DOCUMENT_ROOT"] . "/bob.php");
include($_SERVER["DOCUMENT_ROOT"] . "/fonctions_mysqli.php");

$mysqli = new_mysqli($host, $user, $password, $database); //connection à la DB
$variable_get = filter_input_array(INPUT_GET);

switch ($variable_get['action']){
    case 'add':
        $query="INSERT INTO gens_contact(user_id,contact_id) values (".$_SESSION['id'].",".$variable_get['id'].")";
        break;
    case 'remove':
        $query="DELETE FROM gens_contact WHERE user_id=".$_SESSION['id']." AND contact_id=".$variable_get['id'];
        break;
}

mysqli_query_with_error($mysqli, $query);
echo 'OK';